import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:pretty_qr_code/pretty_qr_code.dart';

class ScanLockView extends StatefulWidget {
  final String tenantCode;
  final String loginSuccessUrl;

  ScanLockView({required this.tenantCode, required this.loginSuccessUrl});

  @override
  State<StatefulWidget> createState() => _ScanLoginState();
}

class _ScanLoginState extends State<ScanLockView> {
  @protected
  late QrCode qrCode;
  @protected
  late QrImage qrImage;

  @override
  void initState() {
    super.initState();

    qrCode = QrCode.fromData(
      data: 'https://pub.dev/packages/pretty_qr_code',
      errorCorrectLevel: QrErrorCorrectLevel.H,
    );

    qrImage = QrImage(qrCode);
  }

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(top: 10),
      child: SizedBox(
        height: 200,
        width: 200,
        child: PrettyQrView(
          qrImage: qrImage,
          decoration: const PrettyQrDecoration(),
        ),
      ),
    );
  }
}
